<template>
  <div class="card">
    <div class="flex-center ">
      <span class="title bold">招聘直播</span>
    </div>
<!--    滚动列表-->
    <el-scrollbar>
      <div class="scrollbar-flex-content">
        <div class="scroll-item" v-for="item in scrollBarData" :key="item.id">
          <a href="#">
            <el-image :src="item.live_pic" class="scroll-item-img" lazy />
            <div :class="item.status==2?'time timeActive':'time'">
              {{ item.live_time }}
            </div>
            <div class="topic">
              {{ item.live_name }}
            </div>
          </a>
        </div>
      </div>
    </el-scrollbar>
  </div>
</template>

<script setup>
import { defineProps } from 'vue' // 引入vue中的defineProps方法
// 定义props
const props = defineProps({
  // 定义scrollBarData类型为数组
  scrollBarData: Array
})

</script>

<style scoped>
/* 滚动栏样式 */
.scrollbar-flex-content {
  display: flex;
  margin-top: 15px;
}
/* 滚动列表项 */
.scroll-item {
  flex-shrink: 0;
  width: 30%;
  margin-right: 8px;
  text-align: center;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  font-size: 13px;
}
/* 滚动栏图片 */
.scroll-item-img {
  width: 100%
}
/* 文字标签 */
.topic {
  width: 100%;
  height: 30px;
  padding: 4px;
  color: white;
  background: rgba(48, 48, 48, 0.4);
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 时间栏 */
.time {
  position: absolute;
  width: 60px;
  text-align: center;
  padding: 4px;
  border-radius: 4px;
  color: rgb(255, 255, 255);
  top: 0;
  left: 0;
  background: rgba(48, 48, 48, 0.4);
}
/* 时间栏激活样式 */
.timeActive {
  color: white;
  background: rgba(252, 70, 24, 0.85);
}
</style>